package com.flowerplus.store.app;

import android.app.Activity;
import android.content.Intent;
import android.support.v4.app.Fragment;

import com.flowerplus.store.MainActivity;
import com.flowerplus.store.app.login.LoginActivity;
import com.flowerplus.store.app.login.LoginModeActivity;
import com.flowerplus.store.app.login.MobileInputActivity;
import com.flowerplus.store.app.photo.PhotoMaxListActivity;
import com.flowerplus.store.app.photo.PhotoMaxListSelectActivity;
import com.flowerplus.store.app.photo.loader.ui.PhotoLoaderActivity;
import com.flowerplus.store.app.photo.model.ImageItem;
import com.flowerplus.store.app.photo.model.PhotoItem;

import java.util.ArrayList;

/**
 * Created by z on.
 * Des:页面导航类
 * Date: 2017/3/8
 */

public class Navigation {


    public static void goSplashActivity(Activity activity) {
//        Intent intent = new Intent(activity, SplashActivity.class);
//        activity.startActivity(intent);
    }

    public static void goMainActivity(Activity activity) {
        Intent intent = new Intent(activity, MainActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK);
        activity.startActivity(intent);
    }




    public static void goPhotoMaxListActivity(Activity activity, ArrayList<PhotoItem> photoItems, int currentPosition) {
        Intent intent = new Intent(activity, PhotoMaxListActivity.class);
        intent.putExtra("photos", photoItems);
        intent.putExtra("currentPosition", currentPosition);
        activity.startActivity(intent);
    }


    public static void goPhotoMaxListSelectActivity(Fragment fragment, ArrayList<ImageItem> photoItems, int currentPosition, int selectedMax) {
        Intent intent = new Intent(fragment.getActivity(), PhotoMaxListSelectActivity.class);
        intent.putExtra("photos", photoItems);
        intent.putExtra("currentPosition", currentPosition);
        intent.putExtra("selectedMax", selectedMax);
        fragment.startActivityForResult(intent, 1001);
    }


    public static void goPhotoLoaderActivity(Activity activity, int code, int maxValue) {
        Intent intent = new Intent(activity, PhotoLoaderActivity.class);
        intent.putExtra("selectedMax", maxValue);
        activity.startActivityForResult(intent, code);
    }


    public static void goLoginActivity(Activity activity) {
        activity.startActivity(new Intent(activity, LoginActivity.class));
    }

    public static void goLoginModeActivity(Activity activity) {
        activity.startActivity(new Intent(activity, LoginModeActivity.class));
    }

    public static void goMobileInputActivity(Activity activity) {
        activity.startActivity(new Intent(activity, MobileInputActivity.class));
    }

}
